package com.qinggeng.common.enums;

import com.qinggeng.common.exception.CustomException;

public enum GoodsImgEnum {

    MAIN (1,"主图"),
    DETAILS(2,"详情"),
    LONG (3,"长图"),;

    private final Integer code;

    private final String value;

    GoodsImgEnum(Integer code, String value){
        this.code = code;
        this.value=value;

    }
    public String getValue(){return value;}

    public Integer getCode()
    {
        return code;
    }


    public static GoodsImgEnum checkCode(Integer code){
        for (GoodsImgEnum enums: GoodsImgEnum.values()){
            if (enums.getCode().equals(code)){
                return enums;
            }
        }
        throw new CustomException("没有这个图片类型");
    }
}
